package com.lumyc.criteria;

import java.util.ArrayList;
import java.util.List;

public class CriteriaMale implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        //定义男性数组
        List<Person> malePersons = new ArrayList<>();

        //遍历参数数组
        for (Person person : persons ) {
            //如果性别为男则加入男性数组
            if(person.getGender().equalsIgnoreCase("male")){
                malePersons.add(person);
            }
        }

        //返回男性数组
        return malePersons;
    }
}
